﻿@using LdCms.Common.Extension
@model LdCms.EF.DbModels.Ld_Sys_Config
@{
    ViewData["Title"] = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页<span class="c-gray en">&gt;</span>系统管理<span class="c-gray en">&gt;</span>基本设置
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form action="@Url.Action("update")" class="form form-horizontal" id="form-add" method="post">
        <div id="tab-system" class="HuiTab">
            <div class="tabBar cl">
                <span>基本设置</span>
                <span>安全设置</span>
                <span>邮件设置</span>
                <span>其他设置</span>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        网站名称：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="title" name="title" placeholder="控制在25个字、50个字节以内" value="@Model.Title" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        关键词：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="keyword" name="keyword" placeholder="5个左右,8汉字以内,用英文,隔开" value="@Model.Keyword" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        描述：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="description" name="description" placeholder="空制在80个汉字，160个字符以内" value="@Model.Description" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        设置网站首页：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="homeUrl" name="homeUrl" placeholder="默认为home/index" value="@Model.HomeUrl" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        css、js、images路径配置：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="styleSrc" name="styleSrc" placeholder="默认为空，为相对路径" value="@Model.StyleSrc" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        上传目录配置：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="uploadRoot" name="uploadRoot" placeholder="默认为uploadfile" value="@Model.UploadRoot" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        底部版权信息：
                    </label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="copyright" name="copyright" placeholder="&copy; 2016 H-ui.net" value="@Model.Copyright" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">备案号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="icpNumber" name="icpNumber" placeholder="京ICP备00000000号" value="@Model.IcpNumber" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">统计代码：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <textarea class="textarea" id="statisticsCode" name="statisticsCode">@Model.StatisticsCode</textarea>
                    </div>
                </div>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">允许访问后台的IP列表：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <textarea class="textarea" name="loginIpAddressWhiteList" id="loginIpAddressWhiteList">@Model.LoginIpAddressWhiteList</textarea>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">后台登录失败最大次数：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" id="maxLoginFail" name="maxLoginFail" value="@Model.MaxLoginFail">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">开启验证：</label>
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                        <div class="check-box">
                            <input type="checkbox" id="isLoginIpAddress" name="isLoginIpAddress" value="1" @(Model.IsLoginIpAddress.ToBool() ? "checked" : "") />
                            <label for="checkbox-1">&nbsp;</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>邮件发送模式：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box">
                            <select class="select" size="1" id="emailSendPattern" name="emailSendPattern">
                                <option value="SMTP" selected="selected">SMTP</option>
                            </select>
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">SMTP服务器：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="emailHost" name="emailHost" value="@Model.EmailHost" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">SMTP 端口：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="emailPort" name="emailPort" class="input-text" value="@Model.EmailPort" >
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">邮箱帐号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.EmailName" id="emailName" name="emailName">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">邮箱密码：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="password" id="emailPassword" name="emailPassword" value="@Model.EmailPassword" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">收件邮箱地址：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="emailAddress" name="emailAddress" value="@Model.EmailAddress" class="input-text">
                    </div>
                </div>
            </div>
            <div class="tabCon">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存 </button>
            </div>
        </div>
    </form>
</div>
@*
    --------------
    页面底部JS脚本
    --------------
*@
@section scripts{
    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="~/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script type="text/javascript" src="~/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="~/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="~/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script type="text/javascript">
        (function ($) {
            $.mainu = {
                init: function () {
                    $('.skin-minimal input').iCheck({
                        checkboxClass: 'icheckbox-blue',
                        radioClass: 'iradio-blue',
                        increaseArea: '20%'
                    });
                    $("#tab-system").Huitab({
                        index: 0
                    });
                },
                formSubmit: function () {
                    $("#form-add").validate({
                        rules: {
                            title: {
                                required: true,
                                minlength: 2,
                                maxlength: 200
                            }
                        },
                        onkeyup: false,
                        focusCleanup: true,
                        success: "valid",
                        submitHandler: function (form) {
                            var isLoginIpAddress = $("input[name='isLoginIpAddress']").is(':checked');
                            $(form).ajaxSubmit({
                                type: "POST",
                                cache: false,
                                data: { isLoginIpAddress: isLoginIpAddress },
                                dataType: "json",
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    if (XMLHttpRequest.status != 200) {
                                        layer.alert("POST[FAIL]", { icon: 5 });
                                    }
                                },
                                success: function (result) {
                                    var state = result.state;          //错误代码
                                    var message = result.message;        //错误说明
                                    if (state == "success") {
                                        layer.msg(message, { icon: 1, time: 3000 });
                                    } else {
                                        layer.msg(message, { icon: 1, time: 3000 });
                                    }
                                }
                            });
                        }
                    });
                }
            };
            $(function () {
                $.mainu.init();
                $.mainu.formSubmit();
            });
        })(jQuery);
    </script>
}

